home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / blitzbasic / blitz-list200994.lha / blitz-list / 000427_blitz-list-request_Fri Jun 17 01:50:48 1994.msg < prev    next >
Internet Message Format  |  1994-09-20  |  8KB

  1. Received: from slick.clare.tased.edu.au (slick.clare.tased.edu.au [147.41.130.5]) by kantti.helsinki.fi (8.6.9/8.6.5) with SMTP id BAA10642 for <blitz-list@helsinki.fi>; Fri, 17 Jun 1994 01:48:06 +0300
  2. Received: (from preece@localhost) by slick.clare.tased.edu.au (8.6.8.1/8.6.6) id IAA01259; Fri, 17 Jun 1994 08:52:00 +1000
  3. Date: Fri, 17 Jun 1994 08:51:59 +1000 (EST)
  4. From: Paul Reece <preece@slick.clare.tased.edu.au>
  5. Subject: Re: Bugs, Bugs, Bugs...
  6. To: Nigel Hughes <nlh1@aber.ac.uk>
  7. cc: blitz-list@helsinki.fi
  8. In-Reply-To: <10571.771754686@mailhost.aber.ac.uk>
  9. Message-ID: <Pine.3.89.9406170833.B1249-0100000@slick.clare.tased.edu.au>
  10. MIME-Version: 1.0
  11. Content-Type: TEXT/PLAIN; charset=US-ASCII
  12. X-Status: 
  13. Status: RO
  14.  
  15. On Thu, 16 Jun 1994, Nigel Hughes wrote:
  16.  
  17. >  Hello everybody,
  18. >         I decided to try and write some of my more useful Blitz functions
  19. > into a library yesterday, so I sit down, read the various bits on library writing, I can
  20. > already code in 68k (written a full game in it 8) so I think no problems! I was wrong!
  21. > I seem to be upsetting blitz with the following routines! They actualy work as far as
  22. > functionality goes, but after using them I get a recoverable alert 0100 000C, which
  23. > is I think, exec saying it has a knackered memory list! Just as a control the second
  24. > function PCFSize (_pcfsize) which quite simply returns the length of a file, causes
  25. > the same things as the very slightly more complex CachePCF (_cachepcf). 
  26.  
  27. I get that recoverable alert all of the time.. I think that it's a BUG in 
  28. Blitz.
  29.  
  30.  - Paul
  31.  
  32. > Could someone please make me look stupid and tell me how I am killing the exec memory
  33. > list! Oh and out of interest when I pass 4 as the required memory type to CachePCF
  34. > it gurus straight away! So I AM doing something really dumb, it's just that after staring at the
  35. > code until 4am, I just cannot see the wood for the trees
  36. > My Flawed Library... 
  37. > ;======================;
  38. > ; PCF LIBRARY FOR BB2  ;
  39. > ;======================;
  40. > #pcflib=40
  41. > !libheader{#pcflib,0,0,0,0}
  42. > !afunction{#long}
  43. > !args{#string,#long}
  44. > !libs{#doslib,#la6}
  45. > !subs{_cachepcf,0,0}
  46. > !name{"CachePCF","File name,Memory Type"}
  47. > !afunction{#long}
  48. > !args{#string}
  49. > !libs{#doslib,#la6}
  50. > !subs{_pcfsize,0,0}
  51. > !name{"PCFSize","File Name"}
  52. > !astatement
  53. > !args{#long,#long}
  54. > !libs
  55. > !subs{_freepcfcache,0,0}
  56. > !name{"FreePCFCache","Cache Start,Cache Length"}
  57. > !libfin
  58. > _cachepcf
  59. >   MOVEM.l a3-a6,-(a7)
  60. >   MOVE.l  #0,file_spot
  61. >   MOVE.l  #0,unlock
  62. >   MOVE.l  d0,file_name
  63. >   MOVE.l  d1,memory_type
  64. >   MOVE.l  d0,d1
  65. >   MOVE.l  #-2,d2            ;shared lock, access read
  66. >   JSR     -$54(a6)          ;Lock(name,type)(d1,d2)
  67. >   CMP.l   #0,d0
  68. >   BEQ     lock_error
  69. >   MOVE.l  d0,file_lock
  70. >   MOVE.l  #$e0,d0
  71. >   MOVE.l  #0,d1
  72. >   ALibJsr $c002             ;Allocate memory for a file
  73. >   BEQ     ma_error1
  74. >   MOVE.l  d0,file_info
  75. >   MOVE.l  file_lock,d1
  76. >   MOVE.l  d0,d2
  77. >   JSR     -$66(a6)          ;Examine(lock,info buffer)(d1,d2)
  78. >   BEQ     examine_error
  79. >   MOVE.l  file_info,a0
  80. >   MOVE.l  $7c(a0),d0        ;How long is the file
  81. >   MOVE.l  d0,file_size
  82. >   MOVE.l  memory_type,d1    ;Ready to allocate all memory
  83. >   ALibJsr $c002
  84. >   BEQ     ma_error2
  85. >   MOVE.l  d0,file_spot      ;store the address
  86. >   MOVE.l  file_lock,d1
  87. >   JSR     -$17a(a6)         ;OpenFromLock(lock)(d1)
  88. >   MOVE.l  d0,file_hand      ;our new handle for the file
  89. >   CMP.l   #0,d0
  90. >   BNE     continue          ;Open OK no need to unlock
  91. > file_error:
  92. >   MOVE.l  file_spot,a1      ;could not open file, need to free memory
  93. >   MOVE.l  file_size,d0      ;then the lock
  94. >   ALibJsr $c003
  95. >   MOVE.l  #0,file_spot      ;no memory carried over
  96. >   BRA     ma_error2         ;Carry on as if no memory was allocated
  97. > continue:
  98. >   MOVE.l  #1,unlock         ;no need to unlock now
  99. >   MOVE.l  d0,d1
  100. >   MOVE.l  file_spot,d2
  101. >   MOVE.l  file_size,d3
  102. >   JSR     -$2a(a6)          ;Read(file,buffer,length)(d1,d2,d3)
  103. >   MOVE.l  d0,read_error     ;save any error number
  104. >                             ;Everything went OK free the file handle
  105. >   MOVE.l  file_hand,d1      ;start tidying up
  106. >   JSR     -$24(a6)          ;Close(file)(d1)
  107. >   MOVE.l  read_error,d0     ;now lets check the read was OK
  108. >   CMP.l   #-1,d0
  109. >   BNE     ma_error2         ;There was NO ERROR in reading
  110. >                             ;AN ERROR MUST FREE MEMORY
  111. >   MOVE.l  file_spot,a1      ;could not read file, need to free memory
  112. >   MOVE.l  file_size,d0      ;then the lock
  113. >   ALibJsr $c003
  114. >   MOVE.l  #0,file_spot      ;no memory carried over
  115. > ma_error2:                  ;Unable to allocate memory for file
  116. >                             ;Nothing to do but move on
  117. > examine_error:              ;Could not look at lock but still must free memory
  118. >   MOVE.l  file_info,a1
  119. >   MOVE.l  #$e0,d0
  120. >   ALibJsr $c003             ;Free file info memory
  121. > ma_error1:                  ;Could not even get memory for file info!
  122. >                             ;But must free the lock IF it was not opened
  123. >   MOVE.l  unlock,d0
  124. >   CMP.l   #1,d0
  125. >   BEQ     lock_error        ;no need to relinquish lock
  126. >   MOVE.l  file_lock,d1
  127. >   JSR     -$5a(a6)          ;Unlock(Lock)(d1)
  128. > lock_error:                 ;No lock no bloody nothing!
  129. > ok:
  130. >   MOVEM.l (a7)+,a3-a6
  131. >   MOVE.l  file_spot,d0      ;every thing went OK! give the user the pointer to the cache
  132. >   RTS
  133. > ;RETURN THE SIZE OF A FILE
  134. > _pcfsize
  135. >   MOVEM.l a3-a6,-(a7)
  136. >   MOVE.l  d0,d1
  137. >   MOVE.l  #-2,d2            ;shared lock, access read
  138. >   JSR     -$54(a6)          ;Lock(name,type)(d1,d2)
  139. >   CMP.l   #0,d0
  140. >   BEQ     size_lock_error
  141. >   MOVE.l  d0,file_lock
  142. >   MOVE.l  #0,file_size
  143. >   MOVE.l  #$e0,d0
  144. >   MOVE.l  #0,d1
  145. >   ALibJsr $c002             ;Allocate memory for a file
  146. >   BEQ     size_ma_error1
  147. >   MOVE.l  d0,file_info
  148. >   MOVE.l  file_lock,d1
  149. >   MOVE.l  d0,d2
  150. >   JSR     -$66(a6)          ;Examine(lock,info buffer)(d1,d2)
  151. >   BEQ     size_examine_error
  152. >   MOVE.l  file_info,a0
  153. >   MOVE.l  $7c(a0),d0        ;How long is the file
  154. >   MOVE.l  d0,file_size
  155. > size_examine_error:         ;Could not look at lock but still must free memory
  156. >   MOVE.l  file_info,a1
  157. >   MOVE.l  #$e0,d0
  158. >   ALibJsr $c003             ;Free file info memory
  159. > size_ma_error1:             ;Could not even get memory for file info!
  160. >                             ;But must free the lock IF it was not opened
  161. >   MOVE.l  file_lock,d1
  162. >   JSR     -$5a(a6)          ;Unlock(Lock)(d1)
  163. > size_lock_error:            ;No lock no bloody nothing!
  164. > size_ok:
  165. >   MOVEM.l (a7)+,a3-a6
  166. >   MOVE.l  file_size,d0      ;every thing went OK!
  167. >   RTS
  168. > file_name: Dc.l 0
  169. > file_lock: Dc.l 0
  170. > file_info: Dc.l 0
  171. > file_size: Dc.l 0
  172. > file_spot: Dc.l 0
  173. > file_hand: Dc.l 0
  174. > unlock:    Dc.l 0
  175. > memory_type: Dc.l 0
  176. > read_error: Dc.l 0
  177. > _freepcfcache:
  178. >   MOVEA.l d0,a1
  179. >   MOVE.l  d1,d0
  180. >   ALibJsr $c003
  181. >   RTS
  182. > size_ma_error1:             ;Could not even get memory for file info!
  183. >                             ;But must free the lock IF it was not opened
  184. >   MOVE.l  file_lock,d1
  185. >   JSR     -$5a(a6)          ;Unlock(Lock)(d1)
  186. > size_lock_error:            ;No lock no bloody nothing!
  187. > size_ok:
  188. >   MOVEM.l (a7)+,a3-a6
  189. >   MOVE.l  file_size,d0      ;every thing went OK!
  190. >   RTS
  191. > file_name: Dc.l 0
  192. > file_lock: Dc.l 0
  193. > file_info: Dc.l 0
  194. > file_size: Dc.l 0
  195. > file_spot: Dc.l 0
  196. > file_hand: Dc.l 0
  197. > unlock:    Dc.l 0
  198. > memory_type: Dc.l 0
  199. > read_error: Dc.l 0
  200. > _freepcfcache:
  201. >   MOVEA.l d0,a1
  202. >   MOVE.l  d1,d0
  203. >   ALibJsr $c003
  204. >   RTS
  205.  
  206. ----------------------------------------------------------------------------
  207. Paul Reece, Student & Network Assistant                               \\\///
  208. Claremont College - Tasmania, Australia                               d oo b   
  209.                                                                       | __ |
  210. preece@slick.clare.tased.edu.au, paul_ree@asgard.clare.tased.edu.au    \__/
  211. ----------------------------------------------------------------------------
  212. The opinions expressed herein are my own and not those of Claremont College!
  213. ----------------------------------------------------------------------------
  214.